package com.bigegg.employee.domain;

import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.utils.SecurityUtils;
import lombok.Data;

import java.util.Date;

/**
 * 注册信息
 *
 * @author sun
 */
@Data
public class RegisterInfo {

    private Long id;

    private String username;

    private String nickname;

    private String password;

    private String avatar;

    private Integer sex;

    private String phoneNumber;

    private String email;


    public SysUser parse2User() {
        SysUser user = new SysUser();
        user.setUserName(this.getUsername());
        user.setPassword(SecurityUtils.encryptPassword(this.getPassword()));
        user.setAvatar(this.getAvatar());
        user.setEmail(this.getEmail());
        user.setNickName(this.getNickname());
        user.setPhonenumber(this.getPhoneNumber());
        user.setSex(this.getSex() == null ? null : this.getSex() + "");
        user.setDeptId(100L);
        user.setCreateTime(new Date());
        return user;
    }

}
